package db_entity

/**
 * @author ljfirst
 * @version V1.0
 * @date 2023/9/6 18:52
 * @author-Email ljfirst@mail.ustc.edu.cn
 * @blogURL https://blog.csdn.net/ljfirst
 * @description
 **/

// TagMate
type TagMate struct {
	TagName     string // "二分法"、"动态规划"
	SolvingTips string // 解决思想
}

type Node struct {
	value int
	next  *Node
}


func get(a, b *Node) *Node {
	if a == nil || b == nil {
		return nil
	}
	getMap := make(map[*Node]bool)
	for a != nil && b != nil {
		_, exist := getMap[a]
		if exist {
			return a
		}
		getMap[a] = true
		_, existb := getMap[b]
		if existb {
			return b
		}
		getMap[b] = true
		a = a.next
		b = b.next
	}
	for a != nil {
		_, exist := getMap[a]
		if exist {
			return a
		}
		getMap[a] = true
		a = a.next
	}
	for b != nil {
		_, exist := getMap[b]
		if exist {
			return b
		}
		getMap[b] = true
		b = b.next
	}
	return nil
}
